import delimited "Data/INGOs Survey - 2019 June Version_September 6, 2019_15.43.csv", clear

drop if distributionchannel=="preview"

gen density_m2a=v188
gen density_m2b=v195
gen density_m3a=v202
gen density_m3b=v209
gen density_m4a=v216
gen density_m4b=v223
gen density_m5a=v230
gen density_m5b=v237

gen funding_m2a=v189
gen funding_m2b=v196
gen funding_m3a=v203
gen funding_m3b=v210
gen funding_m4a=v217
gen funding_m4b=v224
gen funding_m5a=v231
gen funding_m5b=v238

gen mediaattention_m2a=v191
gen mediaattention_m2b=v198
gen mediaattention_m3a=v205
gen mediaattention_m3b=v212
gen mediaattention_m4a=v219
gen mediaattention_m4b=v226
gen mediaattention_m5a=v233
gen mediaattention_m5b=v240

gen concentration_m2a=v192
gen concentration_m2b=v199
gen concentration_m3a=v206
gen concentration_m3b=v213
gen concentration_m4a=v220
gen concentration_m4b=v227
gen concentration_m5a=v234
gen concentration_m5b=v241

gen competition_m2a=v193
gen competition_m2b=v200
gen competition_m3a=v207
gen competition_m3b=v214
gen competition_m4a=v221
gen competition_m4b=v228
gen competition_m5a=v235
gen competition_m5b=v242

gen politicalchange_m2a=v194
gen politicalchange_m2b=v201
gen politicalchange_m3a=v208
gen politicalchange_m3b=v215
gen politicalchange_m4a=v222
gen politicalchange_m4b=v229
gen politicalchange_m5a=v236
gen politicalchange_m5b=v243

gen chosen_found_m1a=""
replace chosen_found_m1a="Yes" if conjoint1grid_1=="Scenario A"
replace chosen_found_m1a="No" if conjoint1grid_1=="Scenario B"
tab chosen_found_m1a conjoint1grid_1, missing

gen chosen_found_m1b=""
replace chosen_found_m1b="Yes" if conjoint1grid_1=="Scenario B"
replace chosen_found_m1b="No" if conjoint1grid_1=="Scenario A"
tab chosen_found_m1b conjoint1grid_1, missing

gen chosen_found_m2a=""
replace chosen_found_m2a="Yes" if conjoint2grid_1=="Scenario A"
replace chosen_found_m2a="No" if conjoint2grid_1=="Scenario B"
tab chosen_found_m2a conjoint2grid_1, missing

gen chosen_found_m2b=""
replace chosen_found_m2b="Yes" if conjoint2grid_1=="Scenario B"
replace chosen_found_m2b="No" if conjoint2grid_1=="Scenario A"
tab chosen_found_m2b conjoint2grid_1, missing

gen chosen_found_m3a=""
replace chosen_found_m3a="Yes" if conjoint3grid_1=="Scenario A"
replace chosen_found_m3a="No" if conjoint3grid_1=="Scenario B"
tab chosen_found_m3a conjoint3grid_1, missing

gen chosen_found_m3b=""
replace chosen_found_m3b="Yes" if conjoint3grid_1=="Scenario B"
replace chosen_found_m3b="No" if conjoint3grid_1=="Scenario A"
tab chosen_found_m3b conjoint3grid_1, missing

gen chosen_found_m4a=""
replace chosen_found_m4a="Yes" if conjoint4grid_1=="Scenario A"
replace chosen_found_m4a="No" if conjoint4grid_1=="Scenario B"
tab chosen_found_m4a conjoint4grid_1, missing

gen chosen_found_m4b=""
replace chosen_found_m4b="Yes" if conjoint4grid_1=="Scenario B"
replace chosen_found_m4b="No" if conjoint4grid_1=="Scenario A"
tab chosen_found_m4b conjoint4grid_1, missing

gen chosen_found_m5a=""
replace chosen_found_m5a="Yes" if conjoint5grid_1=="Scenario A"
replace chosen_found_m5a="No" if conjoint5grid_1=="Scenario B"
tab chosen_found_m5a conjoint5grid_1, missing

gen chosen_found_m5b=""
replace chosen_found_m5b="Yes" if conjoint5grid_1=="Scenario B"
replace chosen_found_m5b="No" if conjoint5grid_1=="Scenario A"
tab chosen_found_m5b conjoint5grid_1, missing

gen chosen_effective_m1a=""
replace chosen_effective_m1a="Yes" if conjoint1grid_3=="Scenario A"
replace chosen_effective_m1a="No" if conjoint1grid_3=="Scenario B"
tab chosen_effective_m1a conjoint1grid_3, missing

gen chosen_effective_m1b=""
replace chosen_effective_m1b="Yes" if conjoint1grid_3=="Scenario B"
replace chosen_effective_m1b="No" if conjoint1grid_3=="Scenario A"
tab chosen_effective_m1b conjoint1grid_3, missing

gen chosen_effective_m2a=""
replace chosen_effective_m2a="Yes" if conjoint2grid_3=="Scenario A"
replace chosen_effective_m2a="No" if conjoint2grid_3=="Scenario B"
tab chosen_effective_m2a conjoint2grid_3, missing

gen chosen_effective_m2b=""
replace chosen_effective_m2b="Yes" if conjoint2grid_3=="Scenario B"
replace chosen_effective_m2b="No" if conjoint2grid_3=="Scenario A"
tab chosen_effective_m2b conjoint2grid_3, missing

gen chosen_effective_m3a=""
replace chosen_effective_m3a="Yes" if conjoint3grid_3=="Scenario A"
replace chosen_effective_m3a="No" if conjoint3grid_3=="Scenario B"
tab chosen_effective_m3a conjoint3grid_3, missing

gen chosen_effective_m3b=""
replace chosen_effective_m3b="Yes" if conjoint3grid_3=="Scenario B"
replace chosen_effective_m3b="No" if conjoint3grid_3=="Scenario A"
tab chosen_effective_m3b conjoint3grid_3, missing

gen chosen_effective_m4a=""
replace chosen_effective_m4a="Yes" if conjoint4grid_3=="Scenario A"
replace chosen_effective_m4a="No" if conjoint4grid_3=="Scenario B"
tab chosen_effective_m4a conjoint4grid_3, missing

gen chosen_effective_m4b=""
replace chosen_effective_m4b="Yes" if conjoint4grid_3=="Scenario B"
replace chosen_effective_m4b="No" if conjoint4grid_3=="Scenario A"
tab chosen_effective_m4b conjoint4grid_3, missing

gen chosen_effective_m5a=""
replace chosen_effective_m5a="Yes" if conjoint5grid_3=="Scenario A"
replace chosen_effective_m5a="No" if conjoint5grid_3=="Scenario B"
tab chosen_effective_m5a conjoint5grid_3, missing

gen chosen_effective_m5b=""
replace chosen_effective_m5b="Yes" if conjoint5grid_3=="Scenario B"
replace chosen_effective_m5b="No" if conjoint5grid_3=="Scenario A"
tab chosen_effective_m5b conjoint5grid_3, missing

reshape long density_m funding_m mediaattention_m concentration_m competition_m politicalchange_m chosen_found_m chosen_effective_m scale_m, i(responseid) j(ConjointNumScenarioLetter 1a 1b 2a 2b 3a 3b 4a 4b 5a 5b)

tab density_m, missing
encode density_m, gen(density_num_temp)
tab density_num_temp density_m, missing nolab
recode density_num_temp(2=1 "Few") (3=2 "Some") (1=3 "A lot"), gen(density_num)
drop density_num_temp density_m
	
tab funding_m, missing
encode funding_m, gen(funding_num_temp)
tab funding_num_temp funding_m, missing nolab
recode funding_num_temp(1=1 "A little") (3=2 "Some") (2=3 "A lot"), gen(funding_num)
drop funding_num_temp funding_m
		
tab mediaattention_m, missing 
encode mediaattention_m , gen(mediaattention_num_temp)
tab mediaattention_num_temp mediaattention_m, missing nolab
recode mediaattention_num_temp(1=1 "A little") (3=2 "Some") (2=3 "A lot"), gen(mediaattention_num)
drop mediaattention_num_temp mediaattention_m		
		
tab concentration_m, missing 
encode concentration_m , gen(concentration_num_temp)
tab concentration_num_temp concentration_m, missing nolab
recode concentration_num_temp(1=1) (2=1) (3=2) (4=3), gen(concentration_num)
label define concentration_num 1 "Not very concentrated" 2 "Somewhat concentrated" 3 "Very concentrated"
label values concentration_num concentration_num
drop concentration_num_temp concentration_m
			
tab competition_m, missing 
encode competition_m , gen(competition_num_temp)
tab competition_num_temp competition_m, missing nolab
recode competition_num_temp(1=1 "A little") (3=2 "Some") (2=3 "A lot"), gen(competition_num)
drop competition_num_temp competition_m
			
tab politicalchange_m, missing 
encode politicalchange_m , gen(politicalchange_num_temp)
tab politicalchange_num_temp politicalchange_m, missing nolab
recode politicalchange_num_temp(1=1 "A little") (3=2 "Some") (2=3 "A lot"), gen(politicalchange_num)
drop politicalchange_num_temp politicalchange_m

tab chosen_found_m, missing	
encode chosen_found_m , gen(chosen_found_num_temp)
tab chosen_found_num_temp chosen_found_m, missing nolab
recode chosen_found_num_temp ( 1=0 "No")(2=1 "Yes"), gen(chosen_found_num)
drop chosen_found_num_temp chosen_found_m
			
tab chosen_effective_m, missing 
encode chosen_effective_m , gen(chosen_effective_num_temp)
tab chosen_effective_num_temp chosen_effective_m, missing nolab
recode chosen_effective_num_temp ( 1=0 "No")(2=1 "Yes"), gen(chosen_effective_num)
drop chosen_effective_num_temp chosen_effective_m
			
reg chosen_found_num i.density_num i.funding_num i.mediaattention_num i.concentration_num i.competition_num i.politicalchange_num, cluster(responseid)

reg chosen_effective_num i.density_num i.funding_num i.mediaattention_num i.concentration_num i.competition_num i.politicalchange_num, cluster(responseid)
